package com.econvent.common.conn;

import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 实现多数据源的管理-多数据库连接池管理
 *
 * @author xiekun
 * @since 1.0
 */

@Slf4j
public class DynamicDataSourceManager {
    /**
     * 用来存放所有的自定义连接池信息
     * */
    private Map<String, DynamicDataSourceDirector> dynamicDataSources;

    private DynamicDataSourceManager() {
        this.dynamicDataSources = new ConcurrentHashMap<>(16);
        initDataSoures();
    }

    /**
     * 静态内部类实现单例模式，创建数据库连接池管理器
     * */
    private static class DynamicDataSourceManagerInstance {
        private static final DynamicDataSourceManager dataSourceManager = new DynamicDataSourceManager() ;
    }

    public static DynamicDataSourceManager getInstance() {
        return DynamicDataSourceManagerInstance.dataSourceManager ;
    }

    /**
     * 用来初始化配置的数据源信息
     * */
    private void initDataSoures() {

    }
}